{extend name="./public/base"/}
{block name="alt"}用户管理{/block}
{block name="alter"}用户列表{/block}
{block name="title"}BangBang用户列表{/block}
{block name="tan"}
	<button class="btn btn-info btn-sm" data-toggle="modal" data-target="#myModal">添加新用户</button>
	<br>
	<br>
	<!-- 模态框（Modal） -->
               <!-- 模态框（Modal） -->
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
                <h4 class="modal-title" id="myModalLabel">添加新用户</h4>
            </div>
            <div class="modal-body">
                <form class="form-horizontal" role="form" action="{:url('addusers')}" method="post" enctype="multipart/form-data">
<div class="form-group">
    <label for="inputPassword" class="col-sm-4 control-label">用户名</label>
    <div class="col-sm-10">
      <input type="text" name="uname" class="form-control"  required>
    </div>
  </div>
  <div class="form-group">
    <label for="inputPassword" class="col-sm-4 control-label">密码</label>
    <div class="col-sm-10">
      <input type="password" name="password" class="form-control"  required>
    </div>
  </div>
  <div class="form-group">
    <label for="inputPassword" class="col-sm-4 control-label">上传头像</label>
    <div class="col-sm-10">
      <input type="file" name="upic" class="form-control" required>
    </div>
  </div>
  <div class="form-group">
    <label for="inputPassword" class="col-sm-4 control-label">性别</label>
    <div class="col-sm-10">
      <!-- <input type="text" name="sshcredit" class="form-control" id="inputPassword" required> -->
       <select class="form-control" name="gender">
      <option value="0">男</option>
      <option value="1">女</option>
    </select>
    </div>
  </div>
  <div class="form-group">
    <label for="inputPassword" class="col-sm-4 control-label">出生日期</label>
    <div class="col-sm-10">
      <input type="date" name="birthdate" class="form-control"  required>
    </div>
  </div>
  <div class="form-group">
    <label for="inputPassword" class="col-sm-4 control-label">邮箱</label>
    <div class="col-sm-10">
      <input type="email" name="email" class="form-control" required>
    </div>
  </div>
  <!-- <div class="form-group">
    <label for="inputPassword" class="col-sm-4 control-label">点赞数</label>
    <div class="col-sm-10">
      <input type="text" name="spraise" class="form-control" id="inputPassword" required>
    </div>
  </div> -->
  <button type="submit" class="btn btn-primary">提交</button>
</form>
            </div>
           
        </div><!-- /.modal-content -->
    </div><!-- /.modal-dialog -->
</div>
<!-- /.modal -->

<!-- <form action="{:url('index')}" style="float: right;margin-top: -40px;margin-right: 50px">
  <input type="text" placeholder="请输入要搜索的用户名">
  <input type="submit" value="搜索">
</form> -->

{/block}
{block name="main"}

			<div class="row">
                    <div class="col-12">
                        <div class="card">
                            <div class="card-block">
                                <div class="card-body">
                                        <table class="table table-striped  mt-3">
                                            <thead>
                                                <tr>
                                                    <th scope="col"><p class="text-center">状态</p></th>
                                                    <th scope="col"><p class="text-center">序号</p></th>
                                                    <th scope="col"><p class="text-center">用户名</p></th>
                                                    <th scope="col"><p class="text-center">性别</p></th>
                                                    <th scope="col"><p class="text-center">出生日期</p></th>
                                                    <th scope="col"><p class="text-center">头像</p></th>
                                                    <th scope="col"><p class="text-center">邮箱</p></th>
                                                    <th scope="col"><p class="text-center">操作</p></th>
                                                </tr>
                                            </thead>
                                            <tbody>
                                                {volist name="users" id="user" key="k"}
                                                <tr>
                                                    <td>
                                                        {if condition="$user.ustatus==0"}<p class="text-center text-success">正常</p>
                                                        {else/}<p class="text-center text-danger">封禁</p>
                                                        {/if}
                                                    </td>
                                                    <td><p class="text-center">{$k+($page-1)*10}</p></td>
                                                
                                                    <td><p class="text-center">{$user.uname}</p></td>
                                                    <td>{if condition="$user.gender==0"}<p class="text-center">男</p>
                                                    	{else/}<p class="text-center">女</p>
														{/if}
                                                    </td>
                                                    <td><p class="text-center">{$user.birthdate}</p></td>
                                                     <td class="text-center">
                                                        <img src="__STATIC__/upload/{$user.upic}" width="70px" height="70px" >
                                                    </td>
                                                    <td><p class="text-center">{$user.email}</p></td>
                                                   
                                                    <td class="text-center">
                                                        
                                                    <div class="btn-group">
    <button type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown">
        <span class="glyphicon glyphicon-cog">Settings</span>
    </button>
    <ul class="dropdown-menu" role="menu">
        <li>
          {if condition="$user.ustatus==0"}
           &nbsp;<a class="text-danger" href="{:url('shield',['id'=>$user.uid])}" onclick="return confirm('真的要封禁此账号么？')"><i class="icon-ban"></i>&nbsp;封禁账号</a>
           {else/}<a class="text-success" href="{:url('shield2',['id'=>$user.uid])}" onclick="return confirm('真的要解封此账号么？')"><i class="icon-user"></i>&nbsp;解除封禁</a>
           {/if}
          
        </li>

        <li>
           &nbsp;<a class="" href="{:url('update',['uid'=>$user.uid])}"><i class="icon-pencil"></i>&nbsp;修改信息</a>
        </li>
        <li>
           &nbsp;<a class="" href="{:url('userDetails',['uid'=>$user.uid])}"><i class="icon-info"></i>&nbsp;查看详情</a>
        </li>
        <li>
              {if condition="$user.password==md5('0000000')"}&nbsp;&nbsp;&nbsp;<button type="button" class="btn btn-default" disabled="disabled"><i class="icon-user"></i>已重置</button>
                                                        {else/}&nbsp;<a class="text-text" href="{:url('resetpassword',['id'=>$user.uid])}" ><i class="icon-user" ></i>&nbsp;重置密码</a>
                                                    {/if}
        </li>
        
    </ul>
</div>

                                                  </td>
                                                  
                                                </tr>
                                                {/volist}
                                                
                                                
                                            </tbody>
                                        </table>
                                        {$users->render()}
                                </div>
                            </div>
                        </div>
                    </div>
                </div>

{/block}
{block name="search"}用户名{/block}
{block name="searchurl"}{:url('find')}{/block}